<?php
class Admin_Form_Newscat extends Zend_Form
{
    public function init()
    {
        $this->setName("admin");

        $newsCatId = new Zend_Form_Element_Hidden('catId');
        $newsCatId->addFilter('Int');
        
        $catName = new Zend_Form_Element_Text('catName');
        $catName->setLabel('Tên danh mục (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $catName->setAttrib('size', 60);
        
        $code = new Zend_Form_Element_Text('catCode');
        $code->setLabel('Mã danh mục (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $code->setAttrib('size', 60);
        
        $ord = new Zend_Form_Element_Text('ord');
        $ord->setLabel('Thứ tự')->addFilter('StripTags')->addFilter('StringTrim')->addFilter('Int');
        $ord->setAttrib('size', 10);
        
        $display = new Zend_Form_Element_Checkbox('display');
        $display->setLabel('Hiển thị');                        

        // submit button
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id','submitbutton');
        $submit->setAttrib('class',"button medium");
                
        // add elements to form
        $this->addElements(array (
            $newsCatId, $catName, $code, $ord, $display, $submit
        ));
    }
}

